package com.xmutca.core.mq.provider;

import com.xmutca.core.mq.RabbitMessage;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author: 彭伟煌(pengweihuang@xmutca.com)
 * @create: 2016-07-12 11:48
 */
public class Main {

    public static void main(String[] args) {
        AbstractApplicationContext ctx = new ClassPathXmlApplicationContext("rabbitmq-provider.xml");
        RabbitMqSender sender = ctx.getBean(RabbitMqSender.class);

        RabbitMessage rabbitMessage = new RabbitMessage();
        rabbitMessage.setStatus(200);
        rabbitMessage.setMessage("xmutca testing....");

        sender.sendDataToCrQueue(rabbitMessage);
        sender.sendFanoutMsg(rabbitMessage);
        sender.sendTopicMsg("zhu.p1", rabbitMessage);
        sender.sendTopicMsg("zhu.p2", rabbitMessage);

        ctx.destroy();
    }
}
